package System.model;


import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONException;
import org.json.JSONObject;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author GuloTosh
 */
public class JsonResult {

    boolean error ;
    String status ;
    JSONObject result  ;

    public JsonResult(boolean error, String status, JSONObject result) {
        this.result = result;
        this.error = error;
        this.status = status;
    }

    public JsonResult( JSONObject result) {
        this.error= false;
        this.status="";
        this.result = result;
    }

    public boolean isError() {
        return error;
    }

    public void setError(boolean error) {
        this.error = error;
    }

    public JSONObject getResult() {
        return result;
    }

    public void setResult(JSONObject result) {
        this.result = result;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        //return super.toString();
        JSONObject saida = new JSONObject() ;
        try {
            saida.put("error", this.error);
            saida.put("status", this.status);
            saida.put("result", this.result);
        } catch (JSONException ex) {
            Logger.getLogger(JsonResult.class.getName()).log(Level.SEVERE, null, ex);
        }

        return saida.toString();
    }



}
